package com.example.commen.utile

import android.content.Context
import android.widget.TextView
import com.bigkoo.pickerview.builder.OptionsPickerBuilder
import com.bigkoo.pickerview.view.OptionsPickerView
import com.blankj.utilcode.util.LogUtils
import com.example.commen.interf.ICell


fun SelectPickerView(context: Context, view: TextView, list: List<String>, iCell: ICell<Int>): OptionsPickerView<String> {
    //条件选择器
    //条件选择器
    val pvOptions: OptionsPickerView<String> = OptionsPickerBuilder(context) { options1, option2, options3, v -> //返回的分别是三个级别的选中位置
        iCell.cell(options1)
        view.text = list[options1]
    }.build()
    pvOptions.setPicker(list)
    pvOptions.show()
    return pvOptions

}
fun SelectPickerView(context: Context,list: List<String>,selectIndex:Int, iCell: ICell<Int>): OptionsPickerView<String> {
    //条件选择器
    //条件选择器
    val pvOptions: OptionsPickerView<String> = OptionsPickerBuilder(context) { options1, option2, options3, v -> //返回的分别是三个级别的选中位置
        iCell.cell(options1)
    }.build()
    pvOptions.setSelectOptions(selectIndex)
    pvOptions.setPicker(list)
    pvOptions.show()
    return pvOptions

}